//
//  HomeViewController.m
//  MyProject
//
//  Created by 雷逊酌 on 2019/1/26.
//  Copyright © 2019年 BuddyZeng. All rights reserved.
//

#import "HomeViewController.h"
#import "OneViewController.h"
#import "TwoViewController.h"
#import "BaseNavigationController.h"
#import "UIColor+ColorChange.h"

@interface HomeViewController ()

@end

@implementation HomeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self load];
    
}

- (void)load{
    
    
    /* 1.  TAB1:  OneViewController */
    OneViewController *oneVc =  [[OneViewController alloc]init];
    BaseNavigationController *oneNc=  [[BaseNavigationController alloc] initWithRootViewController:oneVc];
    //文字普通颜色
    oneNc.tabBarItem.title = @"联系人";
    //文字高亮颜色
     [oneNc.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor colorWithHexString:@"#45c01b"]} forState:UIControlStateSelected];
 
    
    //普通图片
    oneNc.tabBarItem.image = [[UIImage imageNamed:@"contact_normal"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    //高亮图片
    oneNc.tabBarItem.selectedImage = [[UIImage imageNamed:@"contact_pressed"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
 
    
    
    /*2.  TAB2:  TwoViewController */
    TwoViewController *twoVc =  [[TwoViewController alloc]init];
    BaseNavigationController *twoNc=  [[BaseNavigationController alloc] initWithRootViewController:twoVc];
    //文字普通颜色
    twoNc.tabBarItem.title = @"联系人2";
    //文字高亮颜色
    [twoNc.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor colorWithHexString:@"#45c01b"]} forState:UIControlStateSelected];
 
    //普通图片
    twoNc.tabBarItem.image = [[UIImage imageNamed:@"contact_normal"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    //高亮图片
    twoNc.tabBarItem.selectedImage = [[UIImage imageNamed:@"contact_pressed"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    
    
    /*3. 新建一个导航控制器实例的数组 */
    NSArray *controllersArray = @[oneNc,twoNc];
    /*4. 把导航控制器的数组加入到标签控制器*/
    [self setViewControllers:controllersArray animated:YES];
    
    
    
    
    /*********************************
        对于单色图片 利用下面代码可修改高亮颜色
         UIImage *theImage =  [UIImage imageNamed:@"contacts_normal"];
         theImage = [theImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
         imageView.image = theImage;
         imageView.tintColor = [UIColor blueColor];
 
     */
}




@end
